<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <title>std.format</title>
  <link href="./css/style.css" rel="stylesheet" type="text/css"/>
  <!-- <link href="./img/icon.png" rel="icon" type="image/png"/> -->
  <script type="text/javascript" src="./js/jquery.js"></script>
  <script type="text/javascript" src="./js/modules.js"></script>
  <script type="text/javascript" src="./js/quicksearch.js"></script>
  <script type="text/javascript" src="./js/navigation.js"></script>
  <!--<script type="text/javascript" src="./js/jquery.treeview.js"></script>-->
  <script type="text/javascript">
    var g_moduleFQN = "std.format";
  </script>
  
</head>
<body>
<div id="content">
  <h1><a href="./htmlsrc/std.format.html" class="symbol">std.format</a></h1>
  
<div class="summary">This module implements the workhorse functionality for string and
 I/O formatting.  It's comparable to C99's vsprintf().</div>
<dl>
<dt class="decl">int <a class="symbol _function" name="snprintf" href="./htmlsrc/std.format.html#L74" kind="function" beg="74" end="74">snprintf</a><span class="params">(char* <em>s</em>, size_t <em>n</em>, const char* <em>format</em>, ...)</span>; <span class="attrs">[<span class="linkg">extern(C)</span>]</span> <a title="Permalink to this symbol" href="#snprintf" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L74">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">class <a class="symbol _class" name="FormatError" href="./htmlsrc/std.format.html#L80" kind="class" beg="80" end="91">FormatError</a> : Error; <a title="Permalink to this symbol" href="#FormatError" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L80">#</a></dt>
<dd class="ddef">
<div class="summary">Signals a mismatch between a format and its corresponding argument.</div>
<dl>
<dt class="decl"><a class="symbol _ctor" name="FormatError.this" href="./htmlsrc/std.format.html#L82" kind="ctor" beg="82" end="85">this</a><span class="params">()</span>; <a title="Permalink to this symbol" href="#FormatError.this" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L82">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _ctor" name="FormatError.this:2" href="./htmlsrc/std.format.html#L87" kind="ctor" beg="87" end="90">this</a><span class="params">(string <em>msg</em>)</span>; <a title="Permalink to this symbol" href="#FormatError.this:2" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L87">#</a></dt>
<dd class="ddef"></dd></dl></dd>
<dt class="decl">enum <a class="symbol _enum" name="Mangle" href="./htmlsrc/std.format.html#L94" kind="enum" beg="94" end="135">Mangle</a>; <a title="Permalink to this symbol" href="#Mangle" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L94">#</a></dt>
<dd class="ddef">
<dl>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tvoid" href="./htmlsrc/std.format.html#L96" kind="enummem" beg="96" end="96">Tvoid</a> <a title="Permalink to this symbol" href="#Mangle.Tvoid" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L96">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tbool" href="./htmlsrc/std.format.html#L97" kind="enummem" beg="97" end="97">Tbool</a> <a title="Permalink to this symbol" href="#Mangle.Tbool" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L97">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tbyte" href="./htmlsrc/std.format.html#L98" kind="enummem" beg="98" end="98">Tbyte</a> <a title="Permalink to this symbol" href="#Mangle.Tbyte" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L98">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tubyte" href="./htmlsrc/std.format.html#L99" kind="enummem" beg="99" end="99">Tubyte</a> <a title="Permalink to this symbol" href="#Mangle.Tubyte" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L99">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tshort" href="./htmlsrc/std.format.html#L100" kind="enummem" beg="100" end="100">Tshort</a> <a title="Permalink to this symbol" href="#Mangle.Tshort" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L100">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tushort" href="./htmlsrc/std.format.html#L101" kind="enummem" beg="101" end="101">Tushort</a> <a title="Permalink to this symbol" href="#Mangle.Tushort" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L101">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tint" href="./htmlsrc/std.format.html#L102" kind="enummem" beg="102" end="102">Tint</a> <a title="Permalink to this symbol" href="#Mangle.Tint" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L102">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tuint" href="./htmlsrc/std.format.html#L103" kind="enummem" beg="103" end="103">Tuint</a> <a title="Permalink to this symbol" href="#Mangle.Tuint" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L103">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tlong" href="./htmlsrc/std.format.html#L104" kind="enummem" beg="104" end="104">Tlong</a> <a title="Permalink to this symbol" href="#Mangle.Tlong" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L104">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tulong" href="./htmlsrc/std.format.html#L105" kind="enummem" beg="105" end="105">Tulong</a> <a title="Permalink to this symbol" href="#Mangle.Tulong" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L105">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tfloat" href="./htmlsrc/std.format.html#L106" kind="enummem" beg="106" end="106">Tfloat</a> <a title="Permalink to this symbol" href="#Mangle.Tfloat" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L106">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tdouble" href="./htmlsrc/std.format.html#L107" kind="enummem" beg="107" end="107">Tdouble</a> <a title="Permalink to this symbol" href="#Mangle.Tdouble" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L107">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Treal" href="./htmlsrc/std.format.html#L108" kind="enummem" beg="108" end="108">Treal</a> <a title="Permalink to this symbol" href="#Mangle.Treal" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L108">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tifloat" href="./htmlsrc/std.format.html#L110" kind="enummem" beg="110" end="110">Tifloat</a> <a title="Permalink to this symbol" href="#Mangle.Tifloat" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L110">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tidouble" href="./htmlsrc/std.format.html#L111" kind="enummem" beg="111" end="111">Tidouble</a> <a title="Permalink to this symbol" href="#Mangle.Tidouble" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L111">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tireal" href="./htmlsrc/std.format.html#L112" kind="enummem" beg="112" end="112">Tireal</a> <a title="Permalink to this symbol" href="#Mangle.Tireal" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L112">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tcfloat" href="./htmlsrc/std.format.html#L113" kind="enummem" beg="113" end="113">Tcfloat</a> <a title="Permalink to this symbol" href="#Mangle.Tcfloat" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L113">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tcdouble" href="./htmlsrc/std.format.html#L114" kind="enummem" beg="114" end="114">Tcdouble</a> <a title="Permalink to this symbol" href="#Mangle.Tcdouble" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L114">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tcreal" href="./htmlsrc/std.format.html#L115" kind="enummem" beg="115" end="115">Tcreal</a> <a title="Permalink to this symbol" href="#Mangle.Tcreal" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L115">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tchar" href="./htmlsrc/std.format.html#L117" kind="enummem" beg="117" end="117">Tchar</a> <a title="Permalink to this symbol" href="#Mangle.Tchar" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L117">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Twchar" href="./htmlsrc/std.format.html#L118" kind="enummem" beg="118" end="118">Twchar</a> <a title="Permalink to this symbol" href="#Mangle.Twchar" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L118">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tdchar" href="./htmlsrc/std.format.html#L119" kind="enummem" beg="119" end="119">Tdchar</a> <a title="Permalink to this symbol" href="#Mangle.Tdchar" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L119">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tarray" href="./htmlsrc/std.format.html#L121" kind="enummem" beg="121" end="121">Tarray</a> <a title="Permalink to this symbol" href="#Mangle.Tarray" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L121">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tsarray" href="./htmlsrc/std.format.html#L122" kind="enummem" beg="122" end="122">Tsarray</a> <a title="Permalink to this symbol" href="#Mangle.Tsarray" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L122">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Taarray" href="./htmlsrc/std.format.html#L123" kind="enummem" beg="123" end="123">Taarray</a> <a title="Permalink to this symbol" href="#Mangle.Taarray" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L123">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tpointer" href="./htmlsrc/std.format.html#L124" kind="enummem" beg="124" end="124">Tpointer</a> <a title="Permalink to this symbol" href="#Mangle.Tpointer" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L124">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tfunction" href="./htmlsrc/std.format.html#L125" kind="enummem" beg="125" end="125">Tfunction</a> <a title="Permalink to this symbol" href="#Mangle.Tfunction" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L125">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tident" href="./htmlsrc/std.format.html#L126" kind="enummem" beg="126" end="126">Tident</a> <a title="Permalink to this symbol" href="#Mangle.Tident" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L126">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tclass" href="./htmlsrc/std.format.html#L127" kind="enummem" beg="127" end="127">Tclass</a> <a title="Permalink to this symbol" href="#Mangle.Tclass" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L127">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tstruct" href="./htmlsrc/std.format.html#L128" kind="enummem" beg="128" end="128">Tstruct</a> <a title="Permalink to this symbol" href="#Mangle.Tstruct" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L128">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tenum" href="./htmlsrc/std.format.html#L129" kind="enummem" beg="129" end="129">Tenum</a> <a title="Permalink to this symbol" href="#Mangle.Tenum" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L129">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Ttypedef" href="./htmlsrc/std.format.html#L130" kind="enummem" beg="130" end="130">Ttypedef</a> <a title="Permalink to this symbol" href="#Mangle.Ttypedef" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L130">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tdelegate" href="./htmlsrc/std.format.html#L131" kind="enummem" beg="131" end="131">Tdelegate</a> <a title="Permalink to this symbol" href="#Mangle.Tdelegate" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L131">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tconst" href="./htmlsrc/std.format.html#L133" kind="enummem" beg="133" end="133">Tconst</a> <a title="Permalink to this symbol" href="#Mangle.Tconst" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L133">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _enummem" name="Mangle.Tinvariant" href="./htmlsrc/std.format.html#L134" kind="enummem" beg="134" end="134">Tinvariant</a> <a title="Permalink to this symbol" href="#Mangle.Tinvariant" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L134">#</a></dt>
<dd class="ddef"></dd></dl></dd>
<dt class="decl">TypeInfo <a class="symbol _function" name="primitiveTypeInfo" href="./htmlsrc/std.format.html#L141" kind="function" beg="141" end="195">primitiveTypeInfo</a><span class="params">(Mangle <em>m</em>)</span>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#primitiveTypeInfo" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L141">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">void <a class="symbol _function" name="doFormat" href="./htmlsrc/std.format.html#L455" kind="function" beg="455" end="1274">doFormat</a><span class="params">(void delegate(dchar) <em>putc</em>, TypeInfo[] <em>arguments</em>, va_list <em>argptr</em>)</span>; <a title="Permalink to this symbol" href="#doFormat" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L455">#</a></dt>
<dd class="ddef">
<div class="summary">Interprets variadic argument list pointed to by argptr whose types are given
 by arguments[], formats them according to embedded format strings in the
 variadic argument list, and sends the resulting characters to putc.</div>
The variadic arguments are consumed in order.
 Each is formatted into a sequence of chars, using the default format
 specification for its type, and the
 characters are sequentially passed to putc.
 If a char[], wchar[], or dchar[]
 argument is encountered, it is interpreted as a format string. As many
 arguments as specified in the format string are consumed and formatted
 according to the format specifications in that string and passed to putc. If
 there are too few remaining arguments, a FormatError is thrown. If there are
 more remaining arguments than needed by the format specification, the default
 processing of arguments resumes until they are all consumed.
<p class="sec_header">Params:</p>
<table class="params">
<tr><td><em>putc</em></td><td>Output is sent do this delegate, character by character.</td></tr>
<tr><td><em>arguments</em></td><td>Array of TypeInfo's, one for each argument to be formatted.</td></tr>
<tr><td><em>argptr</em></td><td>Points to variadic argument list.</td></tr></table>
<p class="sec_header">Throws:</p>Mismatched arguments and formats result in a FormatError being thrown.
<p class="sec_header">Format_String:</p><a name="format-string"><i>Format strings</i></a>
        consist of characters interspersed with
        <i>format specifications</i>. Characters are simply copied
        to the output (such as putc) after any necessary conversion
        to the corresponding UTF-8 sequence.
<p class="bl"/>
        A <i>format specification</i> starts with a '%' character,
        and has the following grammar:
<p class="bl"/>
<pre>
<i>FormatSpecification</i>:
    <b>'%%'</b>
    <b>'%'</b> <i>Flags</i> <i>Width</i> <i>Precision</i> <i>FormatChar</i>
<p class="bl"/>
<i>Flags</i>:
    <i>empty</i>
    <b>'-'</b> <i>Flags</i>
    <b>'+'</b> <i>Flags</i>
    <b>'#'</b> <i>Flags</i>
    <b>'0'</b> <i>Flags</i>
    <b>' '</b> <i>Flags</i>
<p class="bl"/>
<i>Width</i>:
    <i>empty</i>
    <i>Integer</i>
    <b>'*'</b>
<p class="bl"/>
<i>Precision</i>:
    <i>empty</i>
    <b>'.'</b>
    <b>'.'</b> <i>Integer</i>
    <b>'.*'</b>
<p class="bl"/>
<i>Integer</i>:
    <i>Digit</i>
    <i>Digit</i> <i>Integer</i>
<p class="bl"/>
<i>Digit</i>:
    <b>'0'</b>
    <b>'1'</b>
    <b>'2'</b>
    <b>'3'</b>
    <b>'4'</b>
    <b>'5'</b>
    <b>'6'</b>
    <b>'7'</b>
    <b>'8'</b>
    <b>'9'</b>
<p class="bl"/>
<i>FormatChar</i>:
    <b>'s'</b>
    <b>'b'</b>
    <b>'d'</b>
    <b>'o'</b>
    <b>'x'</b>
    <b>'X'</b>
    <b>'e'</b>
    <b>'E'</b>
    <b>'f'</b>
    <b>'F'</b>
    <b>'g'</b>
    <b>'G'</b>
    <b>'a'</b>
    <b>'A'</b>
</pre>
    <dl>
    <dt><i>Flags</i>
    <dl>
        <dt><b>'-'</b>
        <dd>
        Left justify the result in the field.
        It overrides any <b>0</b> flag.
<p class="bl"/>
        <dt><b>'+'</b>
        <dd>Prefix positive numbers in a signed conversion with a <b>+</b>.
        It overrides any <i>space</i> flag.
<p class="bl"/>
        <dt><b>'#'</b>
        <dd>Use alternative formatting:
        <dl>
            <dt>For <b>'o'</b>:
            <dd> Add to precision as necessary so that the first digit
            of the octal formatting is a '0', even if both the argument
            and the <i>Precision</i> are zero.
            <dt> For <b>'x'</b> (<b>'X'</b>):
            <dd> If non-zero, prefix result with <b>0x</b> (<b>0X</b>).
            <dt> For floating point formatting:
            <dd> Always insert the decimal point.
            <dt> For <b>'g'</b> (<b>'G'</b>):
            <dd> Do not elide trailing zeros.
        </dl>
<p class="bl"/>
        <dt><b>'0'</b>
        <dd> For integer and floating point formatting when not nan or
        infinity, use leading zeros
        to pad rather than spaces.
        Ignore if there's a <i>Precision</i>.
<p class="bl"/>
        <dt><b>' '</b>
        <dd>Prefix positive numbers in a signed conversion with a space.
    </dl>
<p class="bl"/>
    <dt><i>Width</i>
    <dd>
    Specifies the minimum field width.
    If the width is a <b>*</b>, the next argument, which must be
    of type <b>int</b>, is taken as the width.
    If the width is negative, it is as if the <b>-</b> was given
    as a <i>Flags</i> character.
<p class="bl"/>
    <dt><i>Precision</i>
    <dd> Gives the precision for numeric conversions.
    If the precision is a <b>*</b>, the next argument, which must be
    of type <b>int</b>, is taken as the precision. If it is negative,
    it is as if there was no <i>Precision</i>.
<p class="bl"/>
    <dt><i>FormatChar</i>
    <dd>
    <dl>
        <dt><b>'s'</b>
        <dd>The corresponding argument is formatted in a manner consistent
        with its type:
        <dl>
            <dt><b>bool</b>
            <dd>The result is <tt>'true'</tt> or <tt>'false'</tt>.
            <dt>integral types
            <dd>The <b>%d</b> format is used.
            <dt>floating point types
            <dd>The <b>%g</b> format is used.
            <dt>string types
            <dd>The result is the string converted to UTF-8.
            A <i>Precision</i> specifies the maximum number of characters
            to use in the result.
            <dt>classes derived from <b>Object</b>
            <dd>The result is the string returned from the class instance's
            <b>.toString()</b> method.
            A <i>Precision</i> specifies the maximum number of characters
            to use in the result.
            <dt>non-string static and dynamic arrays
            <dd>The result is [s<sub>0</sub>, s<sub>1</sub>, ...]
            where s<sub>k</sub> is the kth element 
            formatted with the default format.
        </dl>
<p class="bl"/>
        <dt><b>'b','d','o','x','X'</b>
        <dd> The corresponding argument must be an integral type
        and is formatted as an integer. If the argument is a signed type
        and the <i>FormatChar</i> is <b>d</b> it is converted to
        a signed string of characters, otherwise it is treated as
        unsigned. An argument of type <b>bool</b> is formatted as '1'
        or '0'. The base used is binary for <b>b</b>, octal for <b>o</b>,
        decimal
        for <b>d</b>, and hexadecimal for <b>x</b> or <b>X</b>.
        <b>x</b> formats using lower case letters, <b>X</b> uppercase.
        If there are fewer resulting digits than the <i>Precision</i>,
        leading zeros are used as necessary.
        If the <i>Precision</i> is 0 and the number is 0, no digits
        result.
<p class="bl"/>
        <dt><b>'e','E'</b>
        <dd> A floating point number is formatted as one digit before
        the decimal point, <i>Precision</i> digits after, the <i>FormatChar</i>,
        &plusmn;, followed by at least a two digit exponent: <i>d.dddddd</i>e<i>&plusmn;dd</i>.
        If there is no <i>Precision</i>, six
        digits are generated after the decimal point.
        If the <i>Precision</i> is 0, no decimal point is generated.
<p class="bl"/>
        <dt><b>'f','F'</b>
        <dd> A floating point number is formatted in decimal notation.
        The <i>Precision</i> specifies the number of digits generated
        after the decimal point. It defaults to six. At least one digit
        is generated before the decimal point. If the <i>Precision</i>
        is zero, no decimal point is generated.
<p class="bl"/>
        <dt><b>'g','G'</b>
        <dd> A floating point number is formatted in either <b>e</b> or
        <b>f</b> format for <b>g</b>; <b>E</b> or <b>F</b> format for
        <b>G</b>.
        The <b>f</b> format is used if the exponent for an <b>e</b> format
        is greater than -5 and less than the <i>Precision</i>.
        The <i>Precision</i> specifies the number of significant
        digits, and defaults to six.
        Trailing zeros are elided after the decimal point, if the fractional
        part is zero then no decimal point is generated.
<p class="bl"/>
        <dt><b>'a','A'</b>
        <dd> A floating point number is formatted in hexadecimal
        exponential notation 0x<i>h.hhhhhh</i>p<i>&plusmn;d</i>.
        There is one hexadecimal digit before the decimal point, and as
        many after as specified by the <i>Precision</i>.
        If the <i>Precision</i> is zero, no decimal point is generated.
        If there is no <i>Precision</i>, as many hexadecimal digits as
        necessary to exactly represent the mantissa are generated.
        The exponent is written in as few digits as possible,
        but at least one, is in decimal, and represents a power of 2 as in
        <i>h.hhhhhh</i>*2<sup><i>&plusmn;d</i></sup>.
        The exponent for zero is zero.
        The hexadecimal digits, x and p are in upper case if the
        <i>FormatChar</i> is upper case.
    </dl>
<p class="bl"/>
    Floating point NaN's are formatted as <b>nan</b> if the
    <i>FormatChar</i> is lower case, or <b>NAN</b> if upper.
    Floating point infinities are formatted as <b>inf</b> or
    <b>infinity</b> if the
    <i>FormatChar</i> is lower case, or <b>INF</b> or <b>INFINITY</b> if upper.
    </dl>
<p class="sec_header">Example:</p><pre class="d_code">
<span class="k">import</span> <span class="i">std</span>.<span class="i">c</span>.<span class="i">stdio</span>;
<span class="k">import</span> <span class="i">std</span>.<span class="i">format</span>;

<span class="k">void</span> <span class="i">myPrint</span>(...)
{
    <span class="k">void</span> <span class="i">putc</span>(<span class="k">char</span> <span class="i">c</span>)
    {
        <span class="i">fputc</span>(<span class="i">c</span>, <span class="i">stdout</span>);
    }

    <span class="i">std</span>.<span class="i">format</span>.<span class="i">doFormat</span>(&amp;<span class="i">putc</span>, <span class="i">_arguments</span>, <span class="i">_argptr</span>);
}

...

<span class="k">int</span> <span class="i">x</span> = <span class="n">27</span>;
<span class="lc">// prints 'The answer is 27:6'</span>
<span class="i">myPrint</span>(<span class="sl">"The answer is %s:"</span>, <span class="i">x</span>, <span class="n">6</span>);
</pre></dd>
<dt class="decl"><a class="symbol _unittest" name="unittest" href="./htmlsrc/std.format.html#L1278" kind="unittest" beg="1278" end="1568">unittest</a>; <a title="Permalink to this symbol" href="#unittest" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L1278">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">struct <a class="symbol _struct" name="StringWriter" href="./htmlsrc/std.format.html#L1580" kind="struct" beg="1580" end="1606">StringWriter</a><span class="tparams">(Char)</span>; <a title="Permalink to this symbol" href="#StringWriter" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L1580">#</a></dt>
<dd class="ddef">
<div class="summary">Implements the static Writer interface for a string. Instantiate it
 with the character type, e.g. StringWriter!(char),
 StringWriter!(wchar), or StringWriter!(dchar). Regardless of
 instantiation, StringWriter supports all character widths; it only
 is the most efficient at accepting the character type it was
 instantiated with.</div>
<dl>
<dt class="decl">alias Char <a class="symbol _alias" name="StringWriter.NativeChar" href="./htmlsrc/std.format.html#L1582" kind="alias" beg="1582" end="1582">NativeChar</a>; <a title="Permalink to this symbol" href="#StringWriter.NativeChar" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L1582">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">Char[] <a class="symbol _variable" name="StringWriter.backend" href="./htmlsrc/std.format.html#L1583" kind="variable" beg="1583" end="1583">backend</a>; <a title="Permalink to this symbol" href="#StringWriter.backend" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L1583">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">void <a class="symbol _function" name="StringWriter.write" href="./htmlsrc/std.format.html#L1584" kind="function" beg="1584" end="1594">write</a><span class="tparams">(C)</span><span class="params">(in C[] <em>s</em>)</span>; <a title="Permalink to this symbol" href="#StringWriter.write" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L1584">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">void <a class="symbol _function" name="StringWriter.putchar" href="./htmlsrc/std.format.html#L1595" kind="function" beg="1595" end="1605">putchar</a><span class="tparams">(C)</span><span class="params">(in C <em>c</em>)</span>; <a title="Permalink to this symbol" href="#StringWriter.putchar" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L1595">#</a></dt>
<dd class="ddef"></dd></dl></dd>
<dt class="decl">struct <a class="symbol _struct" name="FormatInfo" href="./htmlsrc/std.format.html#L1614" kind="struct" beg="1614" end="1637">FormatInfo</a>; <a title="Permalink to this symbol" href="#FormatInfo" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L1614">#</a></dt>
<dd class="ddef">
<dl>
<dt class="decl">short <a class="symbol _variable" name="FormatInfo.width" href="./htmlsrc/std.format.html#L1619" kind="variable" beg="1619" end="1619">width</a>; <a title="Permalink to this symbol" href="#FormatInfo.width" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L1619">#</a></dt>
<dd class="ddef">
<div class="summary">minimum width, default 0. If width == width.max, then width
     was specified as '*' in the format string.</div></dd>
<dt class="decl">short <a class="symbol _variable" name="FormatInfo.precision" href="./htmlsrc/std.format.html#L1623" kind="variable" beg="1623" end="1623">precision</a>; <a title="Permalink to this symbol" href="#FormatInfo.precision" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L1623">#</a></dt>
<dd class="ddef">
<div class="summary">precision, default ushort.max - 1. If precision ==
     precision.max, then precision was specified as '*' in the format string.</div></dd>
<dt class="decl">char <a class="symbol _variable" name="FormatInfo.spec" href="./htmlsrc/std.format.html#L1625" kind="variable" beg="1625" end="1625">spec</a>; <a title="Permalink to this symbol" href="#FormatInfo.spec" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L1625">#</a></dt>
<dd class="ddef">
<div class="summary">The actual format specifier, 's' by default.</div></dd>
<dt class="decl">ubyte <a class="symbol _variable" name="FormatInfo.index" href="./htmlsrc/std.format.html#L1627" kind="variable" beg="1627" end="1627">index</a>; <a title="Permalink to this symbol" href="#FormatInfo.index" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L1627">#</a></dt>
<dd class="ddef">
<div class="summary">Index of the argument, 1 .. ubyte.max. (0 means not used)</div></dd></dl></dd>
<dt class="decl">FormatInfo <a class="symbol _function" name="parseFormatSpec" href="./htmlsrc/std.format.html#L1644" kind="function" beg="1644" end="1729">parseFormatSpec</a><span class="tparams">(S)</span><span class="params">(ref S <em>fmt</em>)</span>; <a title="Permalink to this symbol" href="#parseFormatSpec" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L1644">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">void <a class="symbol _function" name="writeUpToFormatSpec" href="./htmlsrc/std.format.html#L1735" kind="function" beg="1735" end="1755">writeUpToFormatSpec</a><span class="tparams">(Writer, S)</span><span class="params">(ref Writer <em>w</em>, ref S <em>fmt</em>)</span>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#writeUpToFormatSpec" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L1735">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _unittest" name="unittest:2" href="./htmlsrc/std.format.html#L1757" kind="unittest" beg="1757" end="1772">unittest</a>; <a title="Permalink to this symbol" href="#unittest:2" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L1757">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">void <a class="symbol _function" name="formatIntegral" href="./htmlsrc/std.format.html#L1778" kind="function" beg="1778" end="1903">formatIntegral</a><span class="tparams">(Writer, D)</span><span class="params">(ref Writer <em>w</em>, D <em>argx</em>, FormatInfo <em>f</em>)</span>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#formatIntegral" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L1778">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">void <a class="symbol _function" name="formatFloat" href="./htmlsrc/std.format.html#L1909" kind="function" beg="1909" end="1957">formatFloat</a><span class="tparams">(Writer, D)</span><span class="params">(ref Writer <em>w</em>, D <em>obj</em>, FormatInfo <em>f</em>)</span>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#formatFloat" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L1909">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">void <a class="symbol _function" name="formatGeneric" href="./htmlsrc/std.format.html#L1964" kind="function" beg="1964" end="2052">formatGeneric</a><span class="tparams">(Writer, D)</span><span class="params">(ref Writer <em>w</em>, const( void)* <em>arg</em>, FormatInfo <em>f</em>)</span>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#formatGeneric" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L1964">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">int <a class="symbol _function" name="getNthInt" href="./htmlsrc/std.format.html#L2056" kind="function" beg="2056" end="2077">getNthInt</a><span class="tparams">(A...)</span><span class="params">(uint <em>index</em>, A <em>args</em>)</span>; <span class="attrs">[<span class="prot">private</span>]</span> <a title="Permalink to this symbol" href="#getNthInt" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L2056">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl">void <a class="symbol _function" name="formattedWrite" href="./htmlsrc/std.format.html#L2124" kind="function" beg="2124" end="2206">formattedWrite</a><span class="tparams">(Writer, F, A...)</span><span class="params">(ref Writer <em>w</em>, const( F)[] <em>fmt</em>, A <em>args</em>)</span>; <a title="Permalink to this symbol" href="#formattedWrite" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L2124">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _unittest" name="unittest:3" href="./htmlsrc/std.format.html#L2210" kind="unittest" beg="2210" end="2215">unittest</a>; <a title="Permalink to this symbol" href="#unittest:3" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L2210">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _unittest" name="unittest:4" href="./htmlsrc/std.format.html#L2217" kind="unittest" beg="2217" end="2230">unittest</a>; <a title="Permalink to this symbol" href="#unittest:4" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L2217">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _unittest" name="unittest:5" href="./htmlsrc/std.format.html#L2232" kind="unittest" beg="2232" end="2241">unittest</a>; <a title="Permalink to this symbol" href="#unittest:5" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L2232">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _unittest" name="unittest:6" href="./htmlsrc/std.format.html#L2243" kind="unittest" beg="2243" end="2672">unittest</a>; <a title="Permalink to this symbol" href="#unittest:6" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L2243">#</a></dt>
<dd class="ddef"></dd>
<dt class="decl"><a class="symbol _unittest" name="unittest:7" href="./htmlsrc/std.format.html#L2674" kind="unittest" beg="2674" end="2724">unittest</a>; <a title="Permalink to this symbol" href="#unittest:7" class="symlink">¶</a><a title="Go to the HTML source file" class="srclink" href="./htmlsrc/std.format.html#L2674">#</a></dt>
<dd class="ddef"></dd></dl>
</div>
<div id="footer">
  <p>Copyright © 1999-2008 by Digital Mars ®, All Rights Reserved.</p>
  <p>Page generated by <a href="http://code.google.com/p/dil">dil</a> on Sun Dec 28 04:26:40 2008. Rendered by <a href="http://code.google.com/p/dil/wiki/Kandil">kandil</a>.</p>
</div>
</body>
</html>